Skip to main content
POST
/
v1
/
flux-pro-1.0-expand
Expand an image with FLUX.1 Expand [pro] by adding pixels on any side
curl --request POST \
  --url https://api.bfl.ai/v1/flux-pro-1.0-expand \
  --header 'Content-Type: application/json' \
  --header 'x-key: <api-key>' \
  --data '
{
  "image": "<string>",
  "top": 0,
  "bottom": 0,
  "left": 0,
  "right": 0,
  "prompt": "ein fantastisches bild",
  "steps": 50,
  "prompt_upsampling": false,
  "seed": 123,
  "guidance": 60,
  "output_format": "jpeg",
  "safety_tolerance": 2,
  "webhook_url": "<string>",
  "webhook_secret": "<string>"
}
'
import requests

url = "https://api.bfl.ai/v1/flux-pro-1.0-expand"

payload = {
"image": "<string>",
"top": 0,
"bottom": 0,
"left": 0,
"right": 0,
"prompt": "ein fantastisches bild",
"steps": 50,
"prompt_upsampling": False,
"seed": 123,
"guidance": 60,
"output_format": "jpeg",
"safety_tolerance": 2,
"webhook_url": "<string>",
"webhook_secret": "<string>"
}
headers = {
"x-key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'x-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
image: '<string>',
top: 0,
bottom: 0,
left: 0,
right: 0,
prompt: 'ein fantastisches bild',
steps: 50,
prompt_upsampling: false,
seed: 123,
guidance: 60,
output_format: 'jpeg',
safety_tolerance: 2,
webhook_url: '<string>',
webhook_secret: '<string>'
})
};

fetch('https://api.bfl.ai/v1/flux-pro-1.0-expand', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.bfl.ai/v1/flux-pro-1.0-expand",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'image' => '<string>',
'top' => 0,
'bottom' => 0,
'left' => 0,
'right' => 0,
'prompt' => 'ein fantastisches bild',
'steps' => 50,
'prompt_upsampling' => false,
'seed' => 123,
'guidance' => 60,
'output_format' => 'jpeg',
'safety_tolerance' => 2,
'webhook_url' => '<string>',
'webhook_secret' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-key: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.bfl.ai/v1/flux-pro-1.0-expand"

payload := strings.NewReader("{\n \"image\": \"<string>\",\n \"top\": 0,\n \"bottom\": 0,\n \"left\": 0,\n \"right\": 0,\n \"prompt\": \"ein fantastisches bild\",\n \"steps\": 50,\n \"prompt_upsampling\": false,\n \"seed\": 123,\n \"guidance\": 60,\n \"output_format\": \"jpeg\",\n \"safety_tolerance\": 2,\n \"webhook_url\": \"<string>\",\n \"webhook_secret\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("x-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.bfl.ai/v1/flux-pro-1.0-expand")
.header("x-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"image\": \"<string>\",\n \"top\": 0,\n \"bottom\": 0,\n \"left\": 0,\n \"right\": 0,\n \"prompt\": \"ein fantastisches bild\",\n \"steps\": 50,\n \"prompt_upsampling\": false,\n \"seed\": 123,\n \"guidance\": 60,\n \"output_format\": \"jpeg\",\n \"safety_tolerance\": 2,\n \"webhook_url\": \"<string>\",\n \"webhook_secret\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.bfl.ai/v1/flux-pro-1.0-expand")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"image\": \"<string>\",\n \"top\": 0,\n \"bottom\": 0,\n \"left\": 0,\n \"right\": 0,\n \"prompt\": \"ein fantastisches bild\",\n \"steps\": 50,\n \"prompt_upsampling\": false,\n \"seed\": 123,\n \"guidance\": 60,\n \"output_format\": \"jpeg\",\n \"safety_tolerance\": 2,\n \"webhook_url\": \"<string>\",\n \"webhook_secret\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "<string>",
  "polling_url": "<string>",
  "cost": 123,
  "input_mp": 123,
  "output_mp": 123
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

Authorizations

x-key
string
header
required

Body

application/json
image
string
required

A Base64-encoded string representing the image you wish to expand.

top
integer | null
default:0

Number of pixels to expand at the top of the image

Required range: 0 <= x <= 2048
bottom
integer | null
default:0

Number of pixels to expand at the bottom of the image

Required range: 0 <= x <= 2048
left
integer | null
default:0

Number of pixels to expand on the left side of the image

Required range: 0 <= x <= 2048
right
integer | null
default:0

Number of pixels to expand on the right side of the image

Required range: 0 <= x <= 2048
prompt
string | null
default:""

The description of the changes you want to make. This text guides the expansion process, allowing you to specify features, styles, or modifications for the expanded areas.

Example:

"ein fantastisches bild"

steps
integer | null
default:50

Number of steps for the image generation process

Required range: 15 <= x <= 50
Example:

50

prompt_upsampling
boolean | null
default:false

Whether to perform upsampling on the prompt. If active, automatically modifies the prompt for more creative generation

seed
integer | null

Optional seed for reproducibility

guidance
number | null
default:60

Guidance strength for the image generation process

Required range: 1.5 <= x <= 100
output_format
enum<string> | null
default:jpeg

Output format for the generated image. Can be 'jpeg', 'png', or 'webp'.

Available options:
jpeg,
png,
webp
safety_tolerance
integer
default:2

Tolerance level for input and output moderation. Between 0 and 6, 0 being most strict, 6 being least strict.

Required range: 0 <= x <= 6
Example:

2

webhook_url
string<uri> | null

URL to receive webhook notifications

Required string length: 1 - 2083
webhook_secret
string | null

Optional secret for webhook signature verification

Response

Successful Response

id
string
required
polling_url
string
required
cost
number | null

Cost in credits for this request

input_mp
number | null

Input megapixels (2 decimal places)

output_mp
number | null

Output megapixels (2 decimal places)